package uniqueEquipment;

import java.awt.Button;
import java.awt.Choice;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import main.Equipment;
import main.Unit;

public class GandalfWeapons extends Equipment {

	public GandalfWeapons() {
		options = new Choice();
		options.setName("Equipment Options");
		options.add("Staff");
		options.add("Glamdring");
	}
	
	public void applyOptions () {
		// Hard coding for Gandalf here, if there are other effects that change strength
		// that can affect him this is not flexible enough
		if (options.getSelectedItem().equals("Staff")) {
			owner.setStrength(4);
			owner.setBattleBonus(-1);
			owner.setWoundBonus(1);
		}
		else if (options.getSelectedItem().equals("Glamdring")) {
			owner.setStrength(5);
			Button resetStrength = new Button();
			resetStrength.addMouseListener(new MouseListener() {
				public void mouseClicked(MouseEvent arg0) {
					owner.setStrength(4);
				}
				public void mouseEntered(MouseEvent arg0) {}
				public void mouseExited(MouseEvent arg0) {}
				public void mousePressed(MouseEvent arg0) {}
				public void mouseReleased(MouseEvent arg0) {}
			});
			owner.refreshButtons.add(resetStrength);
		}
	}
	
	public void equipTo(Unit u) {
		this.owner = u;
	}
	
	public String toString() {
		return "Staff+Glamdring";
	}
}
